
PM_FUNC_NORM_ATTRIB SetupArray( &Array:iArray, Int:iCellSize ) 
{
	pokemod_funcstart_debug( "SetupArray" );

	if ( iArray == Invalid_Array )
		iArray = ArrayCreate( iCellSize, 1 );
	else
		ArrayClear( iArray );

	pokemod_funcend_debug( "SetupArray" );
}

PM_FUNC_NORM_ATTRIB SetupTrie( &Trie:iTrie )
{
	pokemod_funcstart_debug( "SetupTrie" );

	if ( iTrie == Invalid_Trie )
		iTrie = TrieCreate();
	else
		TrieClear( iTrie );

	pokemod_funcend_debug( "SetupTrie" );
}

PM_FUNC_NORM_ATTRIB SetupPlayer( Int:id )
{
	pokemod_funcstart_debug( "SetupPlayer" );

	PlayerSetInfo( id, PINFO_SETTING_AUTOCATCH, 1 );
	PlayerSetInfo( id, PINFO_LOCATION, max( 0, NameToLocation( SettingGetValue( START_LOCATION ) ) ) );

	if ( PlayerGetInfo( id, PINFO_BOT ) )
	{
		new Int:iVersion;
		do iVersion = random( PM_VERSION );
		while ( iVersion == VERSION_NONE );

		PlayerSetInfo( id, PINFO_VERSION, iVersion );
		player_set_data( id, "PokeMod", "Version", szPokeModVersion[ iVersion ] );
	}
	else
	{
		SetupAbout( id );

		SetupVersion( id );

		PlayerSetInfo( id, PINFO_HUDPOS, -6 );
		SetupHUD( id );

		PlayerSetInfo( id, PINFO_DHUDPOS_X, -100 );
		PlayerSetInfo( id, PINFO_DHUDPOS_Y, 5 );
		SetupDHUD( id );

		SetupInfo( id );
	}

	pokemod_funcend_debug( "SetupPlayer" );
}

PM_FUNC_NORM_ATTRIB SetupAbout( Int:id )
{
	pokemod_funcstart_debug( "SetupAbout" );

	new Int:menu = MenuCreate( "Welcome to the World of Pokemon" );
	MenuAddItem( menu, MENU_REDISPLAY, "This server is using the official PokeMod %s", g_szVersion );
	MenuAddItem( menu, MENU_REDISPLAY, "Created by \yEmp`" );
	MenuAddItem( menu, MENU_REDISPLAY, "Hope you enjoy it." );
	MenuAddItem( menu, MENU_REDISPLAY, "PayPal Donations can be sent to: \rknifeinablender@yahoo.com" );
	MenuExit( id, menu, .bExitOption = true );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupAbout" );
}

PM_FUNC_NORM_ATTRIB SetupInfo( Int:id )
{
	pokemod_funcstart_debug( "SetupInfo" );

	new Int:menu = MenuCreate( "How PokeMod 2.0 Works" );
	MenuAddItem( menu, MENU_REDISPLAY, "Touch Prof. Oak in your base or say /pm to bring up the menu" );
	MenuAddItem( menu, MENU_REDISPLAY, "Players must use the menu to move around the world of Pokemon" );
	MenuAddItem( menu, MENU_REDISPLAY, "Different locations allow you to fight pokemon or find items" );
	MenuAddItem( menu, MENU_REDISPLAY, "Special Thanks To:\y^n          hib^n          Liinuus^n          Tibs^n          sveed^n          Soshi^n          Poop Dreams" );
	MenuExit( id, menu, .bExitOption = true );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupInfo" );
}

PM_FUNC_NORM_ATTRIB SetupHowCatch( Int:id )
{
	pokemod_funcstart_debug( "SetupHowCatch" );

	new Int:menu = MenuCreate( "How to catch Pokemon" );
	MenuAddItem( menu, MENU_REDISPLAY, "When you are fighting wild pokemon" );

	if ( PlayerGetInfo( id, PINFO_SETTING_AUTOCATCH ) )
	{
		MenuAddItem( menu, MENU_REDISPLAY, "And you have pokeballs in your items" );
		MenuAddItem( menu, MENU_REDISPLAY, "Pokeballs will be auto used when the" );
		MenuAddItem( menu, MENU_REDISPLAY, "Wild Pokemon is low on health" );
	}
	else
	{
		MenuAddItem( menu, MENU_REDISPLAY, "Use pokeballs in your items" );
		MenuAddItem( menu, MENU_REDISPLAY, "To try and catch Pokemon" );
	}

	MenuExit( id, menu, .bExitOption = true );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupHowCatch" );
}

PM_FUNC_NORM_ATTRIB SetupVersion( Int:id )
{
	pokemod_funcstart_debug( "SetupVersion" );

	new Int:menu = MenuCreate( "Please select the version you wish to play" );
	MenuAddItem( menu, "vRed", "Red Version" );
	MenuAddItem( menu, "vBlue", "Blue Version" );
	MenuExit( id, menu, .bExitOption = false );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupVersion" );
}

PM_FUNC_NORM_ATTRIB SetupAutoCatch( Int:id )
{
	pokemod_funcstart_debug( "SetupAutoCatch" );

	new Int:iAutoCatch = PlayerGetInfo( id, PINFO_SETTING_AUTOCATCH );
	new Int:menu = MenuCreate( "Would you like to Auto Use Pokeballs?" );
	MenuAddItem( menu, "autocatch1", "\%cYes (Auto Use)", ( iAutoCatch == 1 ) ? 'y' : 'w' );
	MenuAddItem( menu, "autocatch0", "\%cNo (Manual Use)", ( iAutoCatch == 0 ) ? 'y' : 'w' );
	MenuExit( id, menu, .bExitOption = false );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupAutoCatch" );
}

PM_FUNC_NORM_ATTRIB SetupShowDamage( Int:id )
{
	pokemod_funcstart_debug( "SetupShowDamage" );

	new Int:iShowDamage = PlayerGetInfo( id, PINFO_SETTING_SHOWDAMAGE );
	new Int:menu = MenuCreate( "Do you want pokeskills to show damage in events?" );
	MenuAddItem( menu, "showdamage1", "\%cYes (Show Skill Damage)", ( iShowDamage == 1 ) ? 'y' : 'w' );
	MenuAddItem( menu, "showdamage0", "\%cNo (Hide Skill Damage)", ( iShowDamage == 0 ) ? 'y' : 'w' );
	MenuExit( id, menu, .bExitOption = false );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupShowDamage" );
}

PM_FUNC_NORM_ATTRIB SetupShowXPNum( Int:id )
{
	pokemod_funcstart_debug( "SetupShowXPNum" );

	new Int:iShowXPNum = PlayerGetInfo( id, PINFO_SETTING_XPNUM );
	new Int:menu = MenuCreate( "How should Exp be displayed in your HUD?" );
	MenuAddItem( menu, "showxpnum1", "\%cShow Actual Experience Number", ( iShowXPNum == 1 ) ? 'y' : 'w' );
	MenuAddItem( menu, "showxpnum0", "\%cShow as a Percentage", ( iShowXPNum == 0 ) ? 'y' : 'w' );
	MenuExit( id, menu, .bExitOption = false );
	MenuDisplay( id, menu, MENU_SETUP );

	pokemod_funcend_debug( "SetupShowXPNum" );
}

PM_FUNC_NORM_ATTRIB SetupHUD( Int:id )
{
	pokemod_funcstart_debug( "SetupHUD" );

	new Int:menu = MenuCreate( "\yMove where your HUD information displays" );
	MenuAddItem( menu, "hudup", "Move Up" );
	MenuAddItem( menu, "huddown", "Move Down" );
	MenuAddItem( menu, "huddone", "\rKeep HUD Here" );
	MenuExit( id, menu, .bExitOption = false );
	MenuDisplay( id, menu, MENU_SETUP );

	PlayerSetInfo( id, PINFO_SETTING_HUD, 1 );

	pokemod_funcend_debug( "SetupHUD" );
}
PM_FUNC_NORM_ATTRIB SetupShowHUD( Int:id )
{
	pokemod_funcstart_debug( "SetupShowHUD" );

	new Int:hudColor = PlayerGetInfo( id, PINFO_HUD_COLOR );
	if ( hudColor == HUD_TEAM_BASED )
		hudColor = _:cs_get_user_team( id );

	set_hudmessage( .red = cHudColors[ hudColor ][ 0 ],
					.green = cHudColors[ hudColor ][ 1 ],
					.blue = cHudColors[ hudColor ][ 2 ],
					.x = 0.01,
					.y = PlayerGetInfo( id, PINFO_HUDPOS ) * 0.01,
					.effects = 0,
					.fxtime = 0.1,
					.holdtime = 1.0,
					.fadeintime = 0.1,
					.fadeouttime = 0.1,
					.channel = -1
	);

	ShowSyncHudMsg( id, g_iHudSync, "HUD info will appear here (%d)", PlayerGetInfo( id, PINFO_HUDPOS ) );

	pokemod_funcend_debug( "SetupShowHUD" );
}

PM_FUNC_NORM_ATTRIB SetupDHUD( Int:id )
{
	pokemod_funcstart_debug( "SetupDHUD" );

	new Int:menu = MenuCreate( "\yMove where your event information displays" );
	MenuAddItem( menu, "dhudup", "Move Up" );
	MenuAddItem( menu, "dhuddown", "Move Down" );
	if ( PlayerGetInfo( id, PINFO_DHUDPOS_X ) == -100 )
	{
		MenuAddItem( menu, "dhudleftside", "\yLeft Side" );
		MenuAddItem( menu, "dhudrightside", "\yRight Side" );
	}
	else
	{
		MenuAddItem( menu, "dhudleft", "Move Left" );
		MenuAddItem( menu, "dhudright", "Move Right" );
		MenuAddItem( menu, "dhudcenter", "\yCentered" );
	}
	MenuAddItem( menu, "dhuddone", "\rKeep Events Here" );
	MenuExit( id, menu, .bExitOption = false );
	MenuDisplay( id, menu, MENU_SETUP );

	PlayerSetInfo( id, PINFO_SETTING_DHUD, 1 );

	pokemod_funcend_debug( "SetupDHUD" );
}
PM_FUNC_NORM_ATTRIB SetupShowDHUD( Int:id )
{
	pokemod_funcstart_debug( "SetupShowDHUD" );

	new Int:hudColor = PlayerGetInfo( id, PINFO_HUD_COLOR );
	if ( hudColor == HUD_TEAM_BASED )
		hudColor = _:cs_get_user_team( id );

	set_hudmessage( .red = cHudColors[ hudColor ][ 0 ],
					.green = cHudColors[ hudColor ][ 1 ],
					.blue = cHudColors[ hudColor ][ 2 ],
					.x = PlayerGetInfo( id, PINFO_DHUDPOS_X ) * 0.01,
					.y = PlayerGetInfo( id, PINFO_DHUDPOS_Y ) * 0.01,
					.effects = 0,
					.fxtime = 0.1,
					.holdtime = 1.0,
					.fadeintime = 0.1,
					.fadeouttime = 0.1,
					.channel = -1
	);

	ShowSyncHudMsg( id, g_iHudSync, "Event info will appear here (%d:%d)", PlayerGetInfo( id, PINFO_DHUDPOS_X ), PlayerGetInfo( id, PINFO_DHUDPOS_Y ) );

	pokemod_funcend_debug( "SetupShowDHUD" );
}

